package com.zrf.gulimall.order.service;

import com.alipay.api.AlipayApiException;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zrf.gulimall.common.database.utils.PageUtils;
import com.zrf.gulimall.order.entity.OrderEntity;
import com.zrf.gulimall.order.vo.OrderConfirmVo;
import com.zrf.gulimall.order.vo.OrderSubmitVo;
import com.zrf.gulimall.order.vo.PayAsyncVo;
import com.zrf.gulimall.order.vo.SubmitOrderResponseVo;

import java.util.Map;

/**
 * 订单
 *
 * @author zrf
 * @email 120662332@qq.com
 * @date 2021-01-23 17:31:14
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

	/**
	 * 确认订单
	 * @return
	 */
	OrderConfirmVo confirmOrder();

	/**
	 * 下单
	 * @param orderSubmitVo
	 * @return
	 */
	SubmitOrderResponseVo submitOrder(OrderSubmitVo orderSubmitVo);

	/**
	 * 根据订单编号查询订单状态
	 * @param orderSn 订单编号
	 * @return
	 */
	OrderEntity getOrderByOrderSn(String orderSn);

	/**
	 * 关闭订单
	 * @param orderEntity 订单
	 */
	void closeOrder(OrderEntity orderEntity);

	/**
	 * 支付
	 * @param orderSn 订单号
	 * @return
	 */
	String pay(String orderSn) throws AlipayApiException;

	/**
	 * 分页查询当前登录用户的所有订单
	 * @param params 分页参数
	 * @return
	 */
	PageUtils queryPageWithItem(Map<String, Object> params);

	/**
	 * 处理支付结果
	 * @param payAsyncVo 支付结果vo
	 * @return
	 */
	String handlePayResult(PayAsyncVo payAsyncVo);
}

